#!/bin/bash
# 测试脚本

echo "开始运行测试..."

# 后端测试
echo ""
echo "运行后端测试..."
cd backend

if [ -d "venv" ]; then
    source venv/bin/activate
fi

python manage.py test

# 前端测试
echo ""
echo "运行前端测试..."
cd ../frontend

if [ -d "node_modules" ]; then
    npm run test:unit
else
    echo "警告: 未找到node_modules，请先运行 npm install"
fi

cd ..

echo ""
echo "测试完成！"

